package com.android.newsbackstage.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.android.newsbackstage.R;
import com.android.newsbackstage.bean.News;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;


import java.text.SimpleDateFormat;

/**
 * 新闻明细信息
 */
public class NewsDetailActivity extends AppCompatActivity {
    private Activity mActivity;
    private ImageView ivImg;
    private TextView tvTitle;
    private TextView tvDate;
    private TextView tvContent;
    private TextView tvIssuer;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mActivity = this;
        setContentView(R.layout.activity_news_detail);
        ivImg = findViewById(R.id.img);
        tvTitle= findViewById(R.id.title);
        tvDate = findViewById(R.id.date);
        tvContent = findViewById(R.id.content);
        tvIssuer = findViewById(R.id.issuer);
        News news = (News) getIntent().getSerializableExtra("news");
        tvTitle.setText(news.getTitle());
        tvDate.setText(news.getDate());
        tvContent.setText(news.getContent());
        tvIssuer.setText(news.getIssuer());
        Glide.with(mActivity)
                .asBitmap()
                .skipMemoryCache(true)
                .load(news.getImage())
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .into(ivImg);
    }
    public void back(View view){
        finish();
    }
}
